package com.jy.modules.cims.component.api;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.jy.modules.cims.component.annotation.Ehcache;
import com.jy.modules.cims.data.interact.api.request.RequestAttachSearchDTO;
import com.jy.modules.cims.data.interact.api.request.RequestAuditResultReceiveDTO;
import com.jy.modules.cims.data.interact.api.request.RequestCreditBaseSearchDTO;
import com.jy.modules.cims.data.interact.api.request.RequestCreditRedemptionApplyDTO;
import com.jy.modules.cims.data.interact.api.request.RequestCreditRepaymentNoticeDTO;
import com.jy.modules.cims.data.interact.api.request.RequestLoanBaseSearchDTO;
import com.jy.modules.cims.data.interact.api.request.RequestLoanDetailSearchDTO;
import com.jy.modules.cims.data.interact.api.request.RequestLoanRedemptionApplyDTO;
import com.jy.modules.cims.data.interact.api.request.RequestLoanRepaymentNoticeDTO;
import com.jy.modules.cims.data.interact.api.request.RequestLoanResultReceiveDTO;
import com.jy.modules.cims.data.interact.api.request.RequestQuotaApplyDTO;
import com.jy.modules.cims.data.interact.api.request.RequestRefundPlanSearchDTO;
import com.jy.modules.cims.data.interact.api.request.RequestTransferResultReceiveDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseAttachSearchDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseAuditResultReceiveDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseCreditBaseSearchDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseCreditRedemptionApplyDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseCreditRepaymentNoticeDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseLoanBaseSearchDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseLoanDetailSearchDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseLoanRedemptionApplyDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseLoanRepaymentNoticeDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseLoanResultReceiveDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseQuotaApplyDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseRefundPlanSearchDTO;
import com.jy.modules.cims.data.interact.api.response.ResponseTransferResultReceiveDTO;

/**
 * @description 捷越接受外围系统业务请求组件。<br>
 *              接收处理业务方法必须定义<code>public</code>，方法头 <code>@Ehcache</code>开启缓存。
 * @author shengzhoutao
 * 
 */
@Service("com.jy.modules.cims.component.api.JieYueReceiveImpl")
public class JieYueReceiveImpl {

	@Autowired
	@Qualifier("com.jy.modules.cims.component.api.CReceiveQuotaImpl")
	public CReceiveQuotaImpl receiveQuotaImpl;

	@Autowired
	@Qualifier("com.jy.modules.cims.component.api.CReceiveLoanImpl")
	public CReceiveLoanImpl receiveLoanImpl;

	@Autowired
	@Qualifier("com.jy.modules.cims.component.api.CReceiveCreditImpl")
	private CReceiveCreditImpl receiveCreditImpl;

	@Autowired
	@Qualifier("com.jy.modules.cims.component.api.CReceiveSearchImpl")
	private CReceiveSearchImpl receiveSearchImpl;

	/**
	 * @description 接受商户发送贷款转出额度申请/债权转让额度申请业务请求
	 * @param
	 * @return
	 * @throws Exception
	 * @author yujiazheng
	 * @Date
	 */
	@Ehcache
	@Transactional(propagation = Propagation.REQUIRES_NEW, timeout = 30)
	public ResponseQuotaApplyDTO applyQuota(final RequestQuotaApplyDTO content) throws Exception {

		return receiveQuotaImpl.applyQuota(content);
	}

	/**
	 * @description 接受商户查询进件列表请求
	 * @param
	 * @return
	 * @throws Exception
	 * @author tianmaoshui
	 * @Date
	 */
	@Ehcache
	public ResponseLoanBaseSearchDTO searchLoanBase(final RequestLoanBaseSearchDTO content) throws Exception {

		return receiveSearchImpl.searchLoanBase(content);
	}

	/**
	 * @description 接受商户查询进件详细信息请求
	 * @param
	 * @return
	 * @throws Exception
	 * @author tianmaoshui
	 * @Date
	 */
	@Ehcache
	public ResponseLoanDetailSearchDTO searchLoanDetail(final RequestLoanDetailSearchDTO content) throws Exception {

		return receiveSearchImpl.searchLoanDetail(content);
	}

	/**
	 * @description 接受商户查询进件附件信息请求
	 * @param
	 * @return
	 * @throws Exception
	 * @author lizhiqiang
	 * @Date
	 */
	@Ehcache
	public ResponseAttachSearchDTO searchLoanAttach(final RequestAttachSearchDTO content) throws Exception {

		return receiveSearchImpl.searchLoanAttach(content);
	}

	/**
	 * @description 接受商户查询债权附件信息请求
	 * @param
	 * @return
	 * @throws Exception
	 * @author lizhiqiang
	 * @Date
	 */
	@Ehcache
	public ResponseAttachSearchDTO searchCreditAttach(final RequestAttachSearchDTO content) throws Exception {

		return receiveSearchImpl.searchCreditAttach(content);
	}


	/**
	 * @description 接受商户推送审批结果请求：接收商户系统债务人审核结果，并在合作机构系统保存债务人审核结果信息，
	 *              同时生成响应结果反馈给商户 。
	 * @param
	 * @return
	 * @throws Exception
	 * @author zhengchaoshuai
	 * @Date
	 */
	@Ehcache
	@Transactional(propagation = Propagation.REQUIRES_NEW, timeout = 30)
	public ResponseAuditResultReceiveDTO dealAuditResult(final RequestAuditResultReceiveDTO content) throws Exception {

		return receiveLoanImpl.dealAuditResult(content);
	}

	/**
	 * @description 接受商户推送放款结果请求：:接收商户系统放款结果，并在合作机构系统保存放款结果信息， 同时生成响应结果反馈给商户。
	 * @param
	 * @return
	 * @throws Exception
	 * @author zhengchaoshuai
	 * @Date
	 */
	@Ehcache
	@Transactional(propagation = Propagation.REQUIRES_NEW, timeout = 30)
	public ResponseLoanResultReceiveDTO dealLoanResult(final RequestLoanResultReceiveDTO content) throws Exception {

		return receiveLoanImpl.dealLoanResult(content);
	}

	/**
	 * @description 接受商户查询查询债权信息请求
	 * @param
	 * @return
	 * @throws Exception
	 * @author
	 * @Date
	 */
	@Ehcache
	public ResponseCreditBaseSearchDTO searchCreditBase(final RequestCreditBaseSearchDTO content) throws Exception {
		
		return receiveSearchImpl.searchCreditBase(content);
	}

	/**
	 * @description 接受商户推送推送债权审批结果(债权转让结果)， 同时生成响应结果反馈给商户 。
	 * @param
	 * @return
	 * @throws Exception
	 * @author
	 * @Date
	 */
	@Ehcache
	@Transactional(propagation = Propagation.REQUIRES_NEW, timeout = 30)
	public ResponseTransferResultReceiveDTO dealTransferResult(final RequestTransferResultReceiveDTO content) throws Exception {
		
		return receiveCreditImpl.dealTransferResult(content);
	}

	/**
	 * @description 接受商户债权赎回申请请求
	 * @param
	 * @return
	 * @throws Exception
	 * @author
	 * @Date
	 */
	@Ehcache
	@Transactional(propagation = Propagation.REQUIRES_NEW, timeout = 30)
	public ResponseCreditRedemptionApplyDTO applyCreditRedemption(final RequestCreditRedemptionApplyDTO content) throws Exception {
		
		return receiveCreditImpl.applyRedemption(content);
	}

	/**
	 * @description 接受商户贷款回购申请请求
	 * @param
	 * @return
	 * @throws Exception
	 * @author
	 * @Date
	 */
	@Ehcache
	@Transactional(propagation = Propagation.REQUIRES_NEW, timeout = 30)
	public ResponseLoanRedemptionApplyDTO applyLoanRedemption(final RequestLoanRedemptionApplyDTO content) throws Exception {
		
		return receiveLoanImpl.applyRedemption(content);
	}
	
	/**
	 * @description 接受贷款还款通知请求
	 * @param
	 * @return
	 * @throws Exception
	 * @author
	 * @Date
	 */
	@Ehcache
	public ResponseLoanRepaymentNoticeDTO searchLoanCostPlan(final RequestLoanRepaymentNoticeDTO content) throws Exception {
	
		return receiveSearchImpl.searchLoanCostPlan(content);
	}
	
	/**
	 * @description 接受债权还款通知请求
	 * @param
	 * @return
	 * @throws Exception
	 * @author
	 * @Date
	 */
	@Ehcache
	public ResponseCreditRepaymentNoticeDTO searchCreditCostPlan(final RequestCreditRepaymentNoticeDTO content) throws Exception {
	
		return receiveSearchImpl.searchCreditCostPlan(content);
	}
	
	/**
	 * @description 接受商户查询还款计划信息请求
	 * @param content
	 * @return response
	 * @throws Exception
	 * @author shengzhoutao
	 * @Date 2016-11-28
	 */
	@Ehcache
	public ResponseRefundPlanSearchDTO searchRefundPlan(final RequestRefundPlanSearchDTO content) throws Exception {
		
		return receiveSearchImpl.searchRefundPlan(content);
	}
}
